﻿package {
	import flash.display.Sprite;

	import flash.events.Event;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;

	/**
	 * @author Niels
	 */
	public class Main2 extends Sprite {
		
		public function Main2() {
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			
			//this.addChild(this.viewport);
			//this.renderer = new BasicRenderEngine();
			for (var i : Number = 0; i < 3; i++) {
				addAvatar(i);
			}
			
			addEventListener(Event.ENTER_FRAME, handleEnterFrame);
			
		}
		
		private function handleEnterFrame(event:Event):void {
			//plane.yaw(0.5);
			//this.camera.hover(1, (200-mouseX)*.001, (200-mouseY)*.001);
			//renderer.renderScene(scene, camera, viewport);
		}
		
		private function addAvatar(i:Number):void {
			var avatar:Avatar = new Avatar();
			//avatar.blendMode = "erase";
			//trace(avatar);
			avatar.x = i * 90;
			avatar.y = 150;
			if (i==1){
				avatar.head.face.gotoAndStop(2);
				avatar.head.eyeLeft.gotoAndStop(2);
				avatar.head.eyeRight.gotoAndStop(2);
				avatar.head.nose.gotoAndStop(2);
				avatar.head.mouth.gotoAndStop(2);
			}
			addChild(avatar);
			
			//var material:MovieAssetMaterial = new MovieAssetMaterial("Avatar",true);
			//var material:MovieMaterial = new MovieMaterial(avatar, true, true);
			//material.interactive = true;
			//material.oneSide = false;
			//material.smooth = true;
			
			//var plane:Plane = new Plane(material, 120, 180, 1, 1);
			//plane.x = Math.random()*500-250;
			//plane.z = Math.random()*500-250;
			//this.scene.addChild(plane);
		}
	}
}
